<template>
  <el-dialog
      :model-value="dialogVisible"
      @update:model-value="$emit('update:dialogVisible', $event)"
      :title="title"
      width="600px"
  >
    <el-form ref="form" :model="formData" label-position="top" :rules="rules">
      <!-- 表单内容保持不变 -->
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="$emit('update:dialogVisible', false)">取消</el-button>
        <el-button type="primary" @click="submitForm">确认</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
defineProps({
  dialogVisible: Boolean,
  title: String,
  formData: Object
})

const emit = defineEmits(['update:dialogVisible', 'submit'])

const form = ref(null)
const rules = {
  // 验证规则保持不变
}

const submitForm = () => {
  form.value.validate((valid) => {
    if (valid) {
      emit('submit')
      emit('update:dialogVisible', false)
    }
  })
}
</script>